/**
 * @author zhoutao
 *  2010-5-11
 */
package com.jlt.entity.comm;

import java.util.Calendar;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * quartz调度
 * 
 * @author zhoutao
 * 
 */
@Entity
// 表名与类名不相同时重新定义表名.
@Table(name = "qrtz_triggers")
// 默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Quartz {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private String triggerName;
	private String triggerGroup;
	private String jobName;
	private String jobGroup;
	private String description;
	private long nextFireTime;
	private long prevFireTime;
	private int priority;
	private String triggerState;
	private String triggerType;
	private long startTime;
	private long endTime;

	@Override
	public boolean equals(Object obj) {
		return super.equals(obj);
	}

	public String getTriggerName() {
		return triggerName;
	}

	public void setTriggerName(String triggerName) {
		this.triggerName = triggerName;
	}

	public String getTriggerGroup() {
		return triggerGroup;
	}

	public void setTriggerGroup(String triggerGroup) {
		this.triggerGroup = triggerGroup;
	}

	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getJobGroup() {
		return jobGroup;
	}

	public void setJobGroup(String jobGroup) {
		this.jobGroup = jobGroup;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public String getTriggerType() {
		return triggerType;
	}

	public void setTriggerType(String triggerType) {
		this.triggerType = triggerType;
	}

	public String getTriggerState() {
		return triggerState;
	}

	public void setTriggerState(String triggerState) {
		this.triggerState = triggerState;
	}

	public Date getNextFireTime() {
		Calendar ca = Calendar.getInstance();
		ca.setTimeInMillis(nextFireTime);
		return ca.getTime();
	}

	public void setNextFireTime(long nextFireTime) {
		this.nextFireTime = nextFireTime;
	}

	public Date getPrevFireTime() {
		Calendar ca = Calendar.getInstance();
		ca.setTimeInMillis(prevFireTime);
		return ca.getTime();
	}

	public void setPrevFireTime(long prevFireTime) {
		this.prevFireTime = prevFireTime;
	}

	public Date getStartTime() {
		Calendar ca = Calendar.getInstance();
		ca.setTimeInMillis(startTime);
		return ca.getTime();
	}

	public void setStartTime(long startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		if(0==endTime){
			return null;
		}
		Calendar ca = Calendar.getInstance();
		ca.setTimeInMillis(endTime);
		return ca.getTime();
	}

	public void setEndTime(long endTime) {
		this.endTime = endTime;
	}

}
